/*
**	$VER: ahi.h 4.2 (27.4.97)
**
**	ahi.device definitions
**
**	(C) Copyright 1994-1997 Martin Blom
**	All Rights Reserved.
**
** (TAB SIZE: 8)
*/
/*****************************************************************************/
MODULE	'exec/io',
			'utility/tagitem',
			'libraries/iffparse'
/*****************************************************************************/
#ifndef EIGHTSVX_H
/* Do not define Fixed twice */
/* A fixed-point value, 16 bits
						   to the left of the point and
						   16 bits to the right */
#define Fixed LONG
#endif
/*** STRUCTURES */
/* AHIAudioCtrl */
OBJECT AHIAudioCtrl
	UserData:PTR     /* Lots of private data follows! */

/* AHISoundMessage */
OBJECT AHISoundMessage
	Channel:UWORD

/* AHIRecordMessage */
OBJECT AHIRecordMessage
	Type:ULONG,      /* Format of buffer (object) */
	Buffer:PTR,      /* Pointer to the sample array */
	Length:ULONG     /* Number of sample frames in buffer */

/* AHISampleInfo */
OBJECT AHISampleInfo
	Type:ULONG,      /* Format of samples */
	Address:PTR,     /* Address to array of samples */
	Length:ULONG     /* Number of samples in array */

/* AHIAudioModeRequester */
OBJECT AHIAudioModeRequester
	AudioID:ULONG,        /* Selected audio mode */
	MixFreq:ULONG,        /* Selected mixing/sampling frequency */
	LeftEdge:WORD,        /* Coordinates of requester on exit */
	TopEdge:WORD,
	Width:WORD,
	Height:WORD,
	InfoOpened:BOOL,      /* Info window opened on exit? */
	InfoLeftEdge:WORD,    /* Last coordinates of Info window */
	InfoTopEdge:WORD,
	InfoWidth:WORD,
	InfoHeight:WORD,
	UserData:PTR          /* You can store your own data here */

/* AHIEffMasterVolume */
OBJECT AHIEffMasterVolume
	Effect:ULONG,      /* Set to AHIET_MASTERVOLUME */
	Volume:Fixed     /* See autodocs for range! */

/* AHIEffOutputBuffer */
OBJECT AHIEffOutputBuffer
	Effect:ULONG,          /* Set to AHIET_OUTPUTBUFFER */
	Func:PTR TO Hook,    /* These fields are filled by AHI */
	Type:ULONG,          /* Format of buffer */
	Buffer:PTR,          /* Pointer to the sample array */
	Length:ULONG         /* Number of sample frames in buffer */

/* AHIEffDSPMask (V4) */
OBJECT AHIEffDSPMask
	Effect:ULONG,        /* Set to AHIET_DSPMASK */
	Channels:UWORD,    /* Number of elements in array */
	Mask[0]:UBYTE      /* Here follows the array */

#define AHIEDM_WET 		(0)
#define AHIEDM_DRY 		(1)
/* AHIEffDSPEcho (V4) */
OBJECT AHIDSPEcho
	Effect:ULONG,        /* Set to AHIET_DSPECHO */
	Delay:ULONG,       /* In samples */
	Feedback:Fixed,
	Mix:Fixed,
	Cross:Fixed

/* AHIEffChannelInfo (V4) */
OBJECT AHIEffChannelInfo
	Effect:ULONG,          /* Set to AHIET_CHANNELINFO */
	Func:PTR TO Hook,
	Channels:UWORD,
	Pad:UWORD,           /* The rest is filled by AHI */
	Offset[0]:ULONG      /* The array follows */

/*** TAGS */
#define AHI_TagBase 		(TAG_USER)
#define AHI_TagBaseR 		(AHI_TagBase|$8000)
/* AHI_AllocAudioA tags */
#define AHIA_AudioID 		(AHI_TagBase+1)		/* Desired audio mode */
#define AHIA_MixFreq 		(AHI_TagBase+2)		/* Suggested mixing frequency */
#define AHIA_Channels 		(AHI_TagBase+3)		/* Suggested number of channels */
#define AHIA_Sounds 		(AHI_TagBase+4)		/* Number of sounds to use */
#define AHIA_SoundFunc 		(AHI_TagBase+5)		/* End-of-Sound Hook */
#define AHIA_PlayerFunc 		(AHI_TagBase+6)		/* Player Hook */
#define AHIA_PlayerFreq 		(AHI_TagBase+7)		/* Frequency for player Hook (Fixed)*/
#define AHIA_MinPlayerFreq 	(AHI_TagBase+8)		/* Minimum Frequency for player Hook */
#define AHIA_MaxPlayerFreq 	(AHI_TagBase+9)		/* Maximum Frequency for player Hook */
#define AHIA_RecordFunc 		(AHI_TagBase+10)	/* Sample recording Hook */
#define AHIA_UserData 		(AHI_TagBase+11)	/* What to put in ahiac_UserData */
/* AHI_PlayA tags (V4) */
#define AHIP_BeginChannel 	(AHI_TagBase+40)	/* All command tags should be... */
#define AHIP_EndChannel 		(AHI_TagBase+41)	/* ... enclosed by these tags. */
#define AHIP_Freq 		(AHI_TagBase+50)
#define AHIP_Vol 		(AHI_TagBase+51)
#define AHIP_Pan 		(AHI_TagBase+52)
#define AHIP_Sound 		(AHI_TagBase+53)
#define AHIP_Offset 		(AHI_TagBase+54)
#define AHIP_Length 		(AHI_TagBase+55)
#define AHIP_LoopFreq 		(AHI_TagBase+60)
#define AHIP_LoopVol 		(AHI_TagBase+61)
#define AHIP_LoopPan 		(AHI_TagBase+62)
#define AHIP_LoopSound 		(AHI_TagBase+63)
#define AHIP_LoopOffset 		(AHI_TagBase+64)
#define AHIP_LoopLength 		(AHI_TagBase+65)
/* AHI_ControlAudioA tags */
#define AHIC_Play 		(AHI_TagBase+80)	/* Boolean */
#define AHIC_Record 		(AHI_TagBase+81)	/* Boolean */
#define AHIC_MonitorVolume 	(AHI_TagBase+82)
#define AHIC_MonitorVolume_Query  (AHI_TagBase+83)	/* ti_Data is pointer to Fixed (LONG) */
#define AHIC_MixFreq_Query 	(AHI_TagBase+84)	/* ti_Data is pointer to ULONG */
/* --- New for V2, they will be ignored by V1 --- */
#define AHIC_InputGain 		(AHI_TagBase+85)
#define AHIC_InputGain_Query 	(AHI_TagBase+86)	/* ti_Data is pointer to Fixed (LONG) */
#define AHIC_OutputVolume 	(AHI_TagBase+87)
#define AHIC_OutputVolume_Query 	(AHI_TagBase+88)	/* ti_Data is pointer to Fixed (LONG) */
#define AHIC_Input 		(AHI_TagBase+89)
#define AHIC_Input_Query 	(AHI_TagBase+90)	/* ti_Data is pointer to ULONG */
#define AHIC_Output 		(AHI_TagBase+91)
#define AHIC_Output_Query 	(AHI_TagBase+92)	/* ti_Data is pointer to ULONG */
/* AHI_GetAudioAttrsA tags */
#define AHIDB_AudioID 		(AHI_TagBase+100)
#define AHIDB_Driver 		(AHI_TagBaseR+101)	/* Pointer to name of driver */
#define AHIDB_Flags 		(AHI_TagBase+102)	/* Private! */
#define AHIDB_Volume 		(AHI_TagBase+103)	/* Boolean */
#define AHIDB_Panning 		(AHI_TagBase+104)	/* Boolean */
#define AHIDB_Stereo 		(AHI_TagBase+105)	/* Boolean */
#define AHIDB_HiFi 		(AHI_TagBase+106)	/* Boolean */
#define AHIDB_PingPong 		(AHI_TagBase+107)	/* Boolean */
#define AHIDB_MultTable 		(AHI_TagBase+108)	/* Private! */
#define AHIDB_Name 		(AHI_TagBaseR+109)	/* Pointer to name of this mode */
#define AHIDB_Bits 		(AHI_TagBase+110)	/* Output bits */
#define AHIDB_MaxChannels 	(AHI_TagBase+111)	/* Max supported channels */
#define AHIDB_MinMixFreq 	(AHI_TagBase+112)	/* Min mixing freq. supported */
#define AHIDB_MaxMixFreq 	(AHI_TagBase+113)	/* Max mixing freq. supported */
#define AHIDB_Record 		(AHI_TagBase+114)	/* Boolean */
#define AHIDB_Frequencies 	(AHI_TagBase+115)
#define AHIDB_FrequencyArg 	(AHI_TagBase+116)	/* ti_Data is frequency index */
#define AHIDB_Frequency 		(AHI_TagBase+117)
#define AHIDB_Author 		(AHI_TagBase+118)	/* Pointer to driver author name */
#define AHIDB_Copyright 		(AHI_TagBase+119)	/* Pointer to driver copyright notice */
#define AHIDB_Version 		(AHI_TagBase+120)	/* Pointer to driver version string */
#define AHIDB_Annotation 	(AHI_TagBase+121)	/* Pointer to driver annotation text */
#define AHIDB_BufferLen 		(AHI_TagBase+122)	/* Specifies the string buffer size */
#define AHIDB_IndexArg 		(AHI_TagBase+123)	/* ti_Data is frequency! */
#define AHIDB_Index 		(AHI_TagBase+124)
#define AHIDB_Realtime 		(AHI_TagBase+125)	/* Boolean */
#define AHIDB_MaxPlaySamples 	(AHI_TagBase+126)	/* It's sample *frames* */
#define AHIDB_MaxRecordSamples 	(AHI_TagBase+127)	/* It's sample *frames* */
#define AHIDB_FullDuplex 	(AHI_TagBase+129)	/* Boolean */
/* --- New for V2, they will be ignored by V1 --- */
#define AHIDB_MinMonitorVolume 	(AHI_TagBase+130)
#define AHIDB_MaxMonitorVolume 	(AHI_TagBase+131)
#define AHIDB_MinInputGain 	(AHI_TagBase+132)
#define AHIDB_MaxInputGain 	(AHI_TagBase+133)
#define AHIDB_MinOutputVolume 	(AHI_TagBase+134)
#define AHIDB_MaxOutputVolume 	(AHI_TagBase+135)
#define AHIDB_Inputs 		(AHI_TagBase+136)
#define AHIDB_InputArg 		(AHI_TagBase+137)	/* ti_Data is input index */
#define AHIDB_Input 		(AHI_TagBase+138)
#define AHIDB_Outputs 		(AHI_TagBase+139)
#define AHIDB_OutputArg 		(AHI_TagBase+140)	/* ti_Data is input index */
#define AHIDB_Output 		(AHI_TagBase+141)
/* --- New for V4, they will be ignored by V2 and earlier --- */
#define AHIDB_Data 		(AHI_TagBaseR+142)	/* Private! */
/* AHI_BestAudioIDA tags */
/* --- New for V4, they will be ignored by V2 and earlier --- */
#define AHIB_Dizzy 		(AHI_TagBase+190)
/* AHI_AudioRequestA tags */
/* Window control */
#define AHIR_Window 		(AHI_TagBase+200)	/* Parent window */
#define AHIR_Screen 		(AHI_TagBase+201)	/* Screen to open on if no window */
#define AHIR_PubScreenName 	(AHI_TagBase+202)	/* Name of public screen */
#define AHIR_PrivateIDCMP 	(AHI_TagBase+203)	/* Allocate private IDCMP? */
#define AHIR_IntuiMsgFunc 	(AHI_TagBase+204)	/* Function to handle IntuiMessages */
#define AHIR_SleepWindow 	(AHI_TagBase+205)	/* Block input in AHIR_Window? */
#define AHIR_UserData 		(AHI_TagBase+206)	/* What to put in ahiam_UserData */
/* Text display */
#define AHIR_TextAttr 		(AHI_TagBase+220)	/* Text font to use for gadget text */
#define AHIR_Locale 		(AHI_TagBase+221)	/* Locale to use for text */
#define AHIR_TitleText 		(AHI_TagBase+222)	/* Title of requester */
#define AHIR_PositiveText 	(AHI_TagBase+223)	/* Positive gadget text */
#define AHIR_NegativeText 	(AHI_TagBase+224)	/* Negative gadget text */
/* Initial settings */
#define AHIR_InitialLeftEdge 	(AHI_TagBase+240)	/* Initial requester coordinates */
#define AHIR_InitialTopEdge 	(AHI_TagBase+241)
#define AHIR_InitialWidth 	(AHI_TagBase+242)	/* Initial requester dimensions */
#define AHIR_InitialHeight 	(AHI_TagBase+243)
#define AHIR_InitialAudioID 	(AHI_TagBase+244)	/* Initial audio mode id */
#define AHIR_InitialMixFreq 	(AHI_TagBase+245)	/* Initial mixing/sampling frequency */
#define AHIR_InitialInfoOpened 	(AHI_TagBase+246)	/* Info window initially opened? */
#define AHIR_InitialInfoLeftEdge  (AHI_TagBase+247)	/* Initial Info window coords. */
#define AHIR_InitialInfoTopEdge  (AHI_TagBase+248)
#define AHIR_InitialInfoWidth 	(AHI_TagBase+249)	/* Not used! */
#define AHIR_InitialInfoHeight 	(AHI_TagBase+250)	/* Not used! */
/* Options */
#define AHIR_DoMixFreq 		(AHI_TagBase+260)	/* Allow selection of mixing frequency? */
#define AHIR_DoDefaultMode 	(AHI_TagBase+261)	/* Allow selection of default mode? (V4) */
/* Filtering */
#define AHIR_FilterTags 		(AHI_TagBase+270)	/* Pointer to filter taglist */
#define AHIR_FilterFunc 		(AHI_TagBase+271)	/* Function to filter mode id's */
/*** DEFS */
#define AHINAME 			'ahi.device'
#define AHI_INVALID_ID 		(~0)			/* Invalid Audio ID */
#define AHI_DEFAULT_ID 		($00000000)			/* Only for AHI_AllocAudioA()! */
#define AHI_LOOPBACK_ID 		($00000001)			/* Special sample render Audio ID */
#define AHI_DEFAULT_FREQ 	(0)			/* Only for AHI_AllocAudioA()! */
#define AHI_MIXFREQ 		(~0)			/* Special frequency for AHI_SetFreq() */
#define AHI_NOSOUND 		($ffff)			/* Turns a channel off */
/* Set#? Flags */
#define AHISF_IMM 		(1<<0)
#define AHISB_IMM 		(0)
/* Effect Types */
#define AHIET_CANCEL 		(1<<31)			/* OR with effect to disable */
#define AHIET_MASTERVOLUME 	(1)
#define AHIET_OUTPUTBUFFER 	(2)
/* --- New for V4 --- */
#define AHIET_DSPMASK 		(3)
#define AHIET_DSPECHO 		(4)
#define AHIET_CHANNELINFO 	(5)
/* Sound Types */
#define AHIST_NOTYPE 		(~0)			/* Private */
#define AHIST_SAMPLE 		(0)			/* 8 or 16 bit sample */
#define AHIST_DYNAMICSAMPLE 	(1)			/* Dynamic sample */
#define AHIST_INPUT 		(1<<29)			/* The input from your sampler */
#define AHIST_BW 		(1<<30)			/* Private */
/* Sample types */
/* Note that only AHIST_M8S, AHIST_S8S, AHIST_M16S and AHIST_S16S
   are supported by AHI_LoadSound(). */
#define AHIST_M8S 		(0)			/* Mono, 8 bit signed (BYTE) */
#define AHIST_M16S 		(1)			/* Mono, 16 bit signed (WORD) */
#define AHIST_S8S 		(2)			/* Stereo, 8 bit signed (2×BYTE) */
#define AHIST_S16S 		(3)			/* Stereo, 16 bit signed (2×WORD) */
#define AHIST_M32S 		(8)			/* Mono, 32 bit signed (LONG) */
#define AHIST_S32S 		(10)			/* Stereo, 32 bit signed (2×LONG) */
#define AHIST_M8U 		(4)			/* OBSOLETE! */
/* Error codes */
#define AHIE_OK 			(0)			/* No error */
#define AHIE_NOMEM 		(1)			/* Out of memory */
#define AHIE_BADSOUNDTYPE 	(2)			/* Unknown sound type */
#define AHIE_BADSAMPLETYPE 	(3)			/* Unknown/unsupported sample type */
#define AHIE_ABORTED 		(4)			/* User-triggered abortion */
#define AHIE_UNKNOWN 		(5)			/* Error, but unknown */
#define AHIE_HALFDUPLEX 		(6)			/* CMD_WRITE/CMD_READ failure */
/* DEVICE INTERFACE DEFINITIONS FOLLOWS ************************************/
/* Device units */
#define AHI_DEFAULT_UNIT 	(0)
#define AHI_NO_UNIT 		(255)
/* The preference file */
#define ID_AHIU  "AHIU"
#define ID_AHIG  "AHIG"
OBJECT AHIUnitPrefs
	Unit:UBYTE,
	Pad:UBYTE,
	Channels:UWORD,
	AudioMode:ULONG,
	Frequency:ULONG,
	MonitorVolume:Fixed,
	InputGain:Fixed,
	OutputVolume:Fixed,
	Input:ULONG,
	Output:ULONG

OBJECT AHIGlobalPrefs
	DebugLevel:UWORD,         /* Range: 0-3 (for None, Low,
										  High and All) */
	DisableSurround:BOOL,
	DisableEcho:BOOL,
	FastEcho:BOOL,
	MaxCPU:Fixed,
	ClipMasterVolume:BOOL

/* Debug levels */
#define AHI_DEBUG_NONE 		(0)
#define AHI_DEBUG_LOW 		(1)
#define AHI_DEBUG_HIGH 		(2)
#define AHI_DEBUG_ALL 		(3)
/* AHIRequest */
OBJECT AHIRequest
	Std:IOStdReq,              /* Standard IO request */
	Version:UWORD,             /* Needed version */
	Pad1:UWORD,
	Private[2]:ULONG,          /* Hands off! */
	Type:ULONG,                /* Sample format */
	Frequency:ULONG,           /* Sample/Record frequency */
	Volume:Fixed,              /* Sample volume */
	Position:Fixed,            /* Stereo position */
	Link:PTR TO AHIRequest     /* For double buffering */

/* Flags for OpenDevice() */
#define AHIDF_NOMODESCAN 	(1<<0)
#define AHIDB_NOMODESCAN 	(0)
